/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hessingerbg.codebehind;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Vector;

public class spellmanager extends Vector<spell> {

    private final static String filename = "spells.dat";


    public static spellmanager readFile() throws FileNotFoundException, IOException, ClassNotFoundException {
        FileInputStream in = new FileInputStream(filename);
        ObjectInputStream ois = new ObjectInputStream(in);

        return (spellmanager) ois.readObject();
    }

    public void writeFile() throws FileNotFoundException, IOException {
        FileOutputStream out = new FileOutputStream(filename);
        ObjectOutputStream oos = new ObjectOutputStream(out);

        oos.writeObject(this);
        oos.close();
        out.close();
    }

}
